import {Icon, Picker, View} from "@tarojs/components";
import {useState} from "react";
import './selectDates.scss'

export default function SelectDates() {
  const [data, setData] = useState({
    startDate: '',
    endDate: '',
  })
  function onChange (e) {
    setData({...data, ...{[this.key]: e.detail.value}})
  }
  return (
    <View className='lishi-top'>
      <Picker mode='date' onChange={onChange.bind({key: 'startDate'})}>
        <View className='picker'>
          <Icon size='20' type='info' />
          { data.startDate }
        </View>
      </Picker>
      <View>--</View>
      <Picker mode='date' onChange={onChange.bind({key: 'endDate'})}>
        <View className='picker'>
          <Icon size='20' type='info' />
          {data.endDate}
        </View>
      </Picker>
    </View>
  )
}
